<?php
defined('BASEPATH') OR exit('No direct script access allowed');

?>

                    <div class="row">
                        <div class="col-md-6">
                             <div class="box">
                                <div class="box-header with-border">
                                    <h3 class="box-title">用户信息</h3>
                                </div>
                                <div class="box-body">
                                    <table class="table table-striped table-hover">
                                        <tbody>
<?php foreach ($user_info as $user):?>
                                            <tr>
                                                <th><?php echo lang('users_ip_address'); ?></th>
                                                <td><?php echo $user->ip_address; ?></td>
                                            </tr>
                                            <tr style="display:none;">
                                                <th><?php echo lang('users_firstname'); ?></th>
                                                <td><?php echo htmlspecialchars($user->first_name, ENT_QUOTES, 'UTF-8'); ?></td>
                                            </tr>

                                            <tr>
                                                <th><?php echo lang('users_lastname'); ?></th>
                                                <td><?php echo htmlspecialchars($user->last_name, ENT_QUOTES, 'UTF-8'); ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_username'); ?></th>
                                                <td><?php echo htmlspecialchars($user->username, ENT_QUOTES, 'UTF-8'); ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_email'); ?></th>
                                                <td><?php echo htmlspecialchars($user->email, ENT_QUOTES, 'UTF-8'); ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_created_on'); ?></th>
                                                <td><?php echo date('Y-m-d', $user->created_on); ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_last_login'); ?></th>
                                                <td><?php echo ( ! empty($user->last_login)) ? date('Y-m-d', $user->last_login) : NULL; ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_status'); ?></th>
                                                <td><?php echo ($user->active) ? '<span class="label label-success">'.lang('users_active').'</span>' : '<span class="label label-default">'.lang('users_inactive').'</span>'; ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_company'); ?></th>
                                                <td><?php echo htmlspecialchars($user->company, ENT_QUOTES, 'UTF-8'); ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_phone'); ?></th>
                                                <td><?php echo $user->phone; ?></td>
                                            </tr>
                                            <tr>
                                                <th><?php echo lang('users_groups'); ?></th>
                                                <td>
<?php foreach ($user->groups as $group):?>
                                                    <?php echo '<span class="label" style="background:'.$group->bgcolor.'">'.htmlspecialchars($group->name, ENT_QUOTES, 'UTF-8').'</span>'; ?>
<?php endforeach?>
                                                </td>
                                            </tr>
<?php endforeach;?>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                         </div>

                        <div class="col-md-6">
                        <?php if($isadmin==1){ ?>
                             <div class="box">
                                <div class="box-header with-border">
                                    <h3 class="box-title">用户权限</h3> 
                                    <div class="box-tools pull-right">
                                    <button type="button" class="btn " >
                                        <i class="fa fa-wrench"></i> <?php echo anchor("backend/ionauth/users/edit_permission/".$user->id, '管理用户权限'); ?></a> </button>
                                    </div>
                                </div>
                                <div class="box-body">
                                
                                 <table class="table table-striped table-hover">
                                        <tbody>
                                        
<?php foreach($user_acl as $acl) : ?>
   <tr>
                                                <th><?php echo $acl['name']; ?> </th>
                                                <td><?php if($this->ion_auth_acl->has_permission($acl['key'], $user_acl)) : ?>允许<?php else: ?>禁止<?php endif; ?><?php if($acl['inherited']) : ?> (<strong>继承</strong>)<?php endif; ?></td>
    <?php endforeach; ?>  </tbody></tr>
                                    </table>

                                </div>
                            </div>
                            <?php } ?>
                        </div>
                    </div>
              